package com.tangyh.lamp.common.util;

import java.io.InputStream;

/**
 */

public class EnvironmentUtils {

    private static final String ROOT_PATH = Thread.currentThread().getContextClassLoader().getResource("").getPath();

    /**
     * 获取指定文件在Resource下的路径
     *
     * @param fileName
     * @return
     */
    public static String getClasspathFilePath(String fileName) {
        return ROOT_PATH.concat(fileName);
    }

    /**
     * 获取资源文件路径下的文件
     *
     * @param fileName
     * @return
     */
    public static InputStream getClasspathFileStream(String fileName) {
        return Thread.currentThread().getContextClassLoader().getResourceAsStream(fileName);
    }
}
